<template>
  <el-card @click.native="handleCardClick" class="box-card">
    <div class="card-title">
      <span>{{ card_title }}</span>
    </div>
    <template v-if="ytd_data">
      <div class="card-mid">
        <div class="slider-main">
          <span class="span-class">{{ ytd_data.value + '%' }}</span>
          <div class="slider-content">
            <div
              class="slider-show"
              :style="{width: ytd_data.value + '%'}"
            ></div>
          </div>
        </div>
      </div>
    </template>
    <div class="card-content">
      <el-row :gutter="21">
        <el-col :span="8">
          <div>
            <span>月环比</span>
            <span>{{ ytd_data.mbasis }}</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div>
            <span>周环比</span>
            <span>{{ ytd_data.wbasis }}</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div>
            <span>月同比</span>
            <span>{{ ytd_data.myear }}</span>
          </div>
        </el-col>
      </el-row>
    </div>
    </div>
  </el-card>
</template>
<script>
const SliderBar = () => import("@/pages/contents/main/components/SliderBar");
export default {
  model: {
    prop: "ytd_data",
    event: "update"
  },
  props: {
    card_data: Array,
    card_title: String,
    ytd_data: Object
  },
  data() {
    return {};
  },
  components: {
    SliderBar
  },
  methods: {
    handleCardClick() {
      // console.log('click')
      // this.$emit('card_click')
    }
  }
};
</script>
<style scoped>
.card-mid {
  width: 100%;
}
.box-card {
  line-height: 20px;
  border-radius: 10px;
  width: 100%;
}
.card-title {
  text-align: center;
  font-size: 20px;
  color: #676668;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  /* 让鼠标不能选中 */
  user-select: none;
}
.card-content {
  text-align: center;
  color: #adadad;
  width: 100%;
  /* 让鼠标不能选中 */
  user-select: none;
  margin-top: 10px;
}
.slider-main {
  line-height: 50px;
  border-radius: 10px;
  text-align: center;
  width: 100%;
}
.slider-content {
  background-color: #fee3e6;
  width: 100%;
  height: 5px;
  border-radius: 5px;
  line-height: 10px;
  /* 让鼠标不能选中 */
  user-select: none;
}
.slider-show {
  background-color: #f75464;
  height: 5px;
  width: 100%;
  border-radius: 5px;
  /* 让鼠标不能选中 */
  user-select: none;
}
.span-class {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 30px;
  color: #f75464;
  border-radius: 5px;
  /* 让鼠标不能选中 */
  user-select: none;
}

.el-row {
  margin-bottom: 20px;
}
.el-row:last-child {
  margin-bottom: 0;
}
.el-col {
  border-radius: 4px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>